package UI;

import java.awt.Component;
import java.awt.MouseInfo;
import java.awt.Point;

public class MouseTracker extends Thread{
	
	private Main main;
	
	public MouseTracker(Main m){
		main = m;
	}

	public void run(){
		System.out.println("Mouse tracker is running.");
		Point l;
		while(true){
			l = MouseInfo.getPointerInfo().getLocation();
			if(main.contains(l)){
				main.setAim(l.x,l.y);
			}
			try {
				Thread.sleep(10);
			} catch (InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}
	
}
